package com.example.administrator.z.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.example.administrator.z.R;
import com.example.administrator.z.ui.SchoolMessageActivity;
import com.example.administrator.z.util.ActionSheetDialog;
import com.squareup.picasso.Picasso;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import cn.bingoogolapple.bgabanner.BGABanner;
import cn.bingoogolapple.bgabanner.BGALocalImageSize;
import de.hdodenhof.circleimageview.CircleImageView;

public class HomePagerFragment extends Fragment implements View.OnClickListener {
    private ImageView point1,point2,point3;
    private List<View>mList = new ArrayList<>();
    private View view1 , view2, view3;
    private ViewPager mViewPager;
    private BGABanner mContentBanner ;
    private CircleImageView profile_image;
    private RelativeLayout tongzhi;



    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         View view = inflater.inflate(R.layout.fragment_homepager, null);
        findview(view);
        return view;
    }

    private void findview(View view) {
        tongzhi = (RelativeLayout) view.findViewById(R.id.tongzhi);
        mContentBanner = (BGABanner) view.findViewById(R.id.banner_guide_content);
        BGALocalImageSize localImageSize = new BGALocalImageSize(720, 1280, 320, 640);
        mContentBanner.setData(localImageSize, ImageView.ScaleType.CENTER_CROP,
                R.drawable.class1,
                R.drawable.class2,
                R.drawable.class3);

        profile_image = (CircleImageView) view.findViewById(R.id.profile_image);
        profile_image.setOnClickListener(this);
        tongzhi.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.profile_image:
                new ActionSheetDialog(getContext())
                        .builder()
                        .setCancelable(false)
                        .setCanceledOnTouchOutside(false)
                        .addSheetItem("拍照", ActionSheetDialog.SheetItemColor.Blue,
                                new ActionSheetDialog.OnSheetItemClickListener() {
                                    @Override
                                    public void onClick(int which) {

                                    }
                                })
                        .addSheetItem("相册", ActionSheetDialog.SheetItemColor.Blue,
                                new ActionSheetDialog.OnSheetItemClickListener() {
                                    @Override
                                    public void onClick(int which) {

                                    }
                                }).show();

                break;

            case R.id.tongzhi:
                startActivity(new Intent(getActivity(),SchoolMessageActivity.class));
        }
    }
}
